# -*- coding: utf-8 -*-
# file: forms.py
# author: JinTian
# time: 17/03/2017 8:46 PM
# Copyright 2017 JinTian. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------
"""
now this is the most difficult part!!
we are going upload candidate profiles into database
and candidates photos must be saved in a different table!
"""
from django.forms import ModelForm
from findlove.models import Candidate, CandidatePhoto

# 移动端form上传过来的key可以比这里的多，但是不能比这里的少，也就是说这里的form是远程的一个子集


class CandidateForm(ModelForm):
    class Meta:
        model = Candidate
        fields = ['candidate_name', 'candidate_gender', 'candidate_birthday', 'candidate_school',
                  'candidate_grade', 'candidate_home', 'candidate_phone', 'candidate_wechat', 'candidate_QQ',
                  'uploader_name', 'uploader_wechat', 'uploader_phone', 'uploader_school', 'uploader_campus_card',
                  'uploader_candidate_relation', 'candidate_expect', 'candidate_describe', 'uploader_appraise']
        #  这里没有加uploader_campus_card_url，在view那里追加看看行不行


class CandidatePhotoForm(ModelForm):
    class Meta:
        model = CandidatePhoto
        # fields = ['candidate', 'candidate_photo', 'candidate_photo_url']
        fields = ['candidate', 'candidate_photo', 'candidate_photo_url']
